<?php
namespace Admin\Model;
use Think\Model;

class SysparamsModel extends Model {

    //通过类型获取
    public function getBytype($type = 0){
        if (empty($type)) {
            return false;
        }

        return $this->where(array('type' => $type))->select();
    }

    //获取全部
    public function getAllparams(){
        return $this->select();
    }


    public function saveByKey($key, $value){
        if (empty($key)) {
            return false;
        }

        $res = $this->data(['sysval'=>$value])->where(array('syskey'=>$key))->save();

        return $res !== false;
    }
}
